#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include "contact.h"
void menu(void)
{
	printf("****    1.Addition      2.Delete   ****\n");
	printf("****    3.Modifier      4.Sort     ****\n");
	printf("****    5.Show          6.Search   ****\n");
	printf("****    0.exit                     ****\n");

}

int main()
{
	
	struct contact con;
	Init(&con);
	Load(&con);

	int a = 0;//conserve the number user inputted
	do
	{ 
		menu();
		
	scanf("%d", &a);
		switch (a)
		{
          case 1:
		{
			  Add(&con);
             break;
		}
		  case 2:
		  {
			  Del_name(&con);
			  break;
		  }
		  case 3:
		  {
			  Mod(&con);
			  break;
		  }
		  case 4:
		  {
			  Sort(&con);
			  break;
		  }
		  case 5:
		  {
			  Show(&con);
			  break;
		  }
		  case 6:
		  {
			  Search(&con);
			  break;
		  }
		  case 0:
		  {
			  Save(&con);
			  Destory(&con);
			  printf("have exited\n");
			  break;
		  }
		  default:
		  {
			  
			  printf("Please input again\n");
			  break;
		  }

		}
		
	} while (a);
		return 0;
}